Skip to content

Commit

Permalink
Merge pull request #1 from nekoding/development
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
nekoding authored Aug 25, 2022
2 parents 5b0eba7 + 8ddcca5 commit 240c4c3
Show file tree
Hide file tree
Showing 10 changed files with 547 additions and 544 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ Work in progress
- [x] CC sales transaction
- [x] CC refund transaction
- [x] CC partial refund transaction

- [x] CC save card using cust_code
- [x] CC get info
- [] CC update
- [] CC delete
### Testing

```bash
Expand Down
705 changes: 241 additions & 464 deletions composer.lock

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions resources/views/softbank_cc_token.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<head>
<script src="{{ $token_script_url ?? config('laravel-softbank.token_endpoint') }}"></script>
</head>

<body>
<div id="result"></div>

<script>
document.addEventListener('DOMContentLoaded', (event) => {
com_sbps_system.generateToken({
merchantId: "{{ $merchant_id }}",
serviceId: "{{ $service_id }}",
ccNumber: "{{ $cc_num }}",
ccExpiration: "{{ $cc_exp }}",
securityCode: "{{ $cc_seq }}"
}, (res) => {
const result = document.getElementById('result')
result.append(JSON.stringify(res))
});
})
</script>

</body>
</html>
46 changes: 44 additions & 2 deletions src/Contract/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ interface Payload
{

/**
* Compose payload data
* Create payload data
*
* @return self
*/
public static function compose(array $params): self;
public static function create(array $params): self;

/**
* Get the value of merchantId
Expand Down Expand Up @@ -281,4 +281,46 @@ public function getPaymentOption();
*/
public function setPaymentOption($paymentOption): self;


/**
* getSpsCustNo
*
* @return string
*/
public function getSpsCustNo(): ?string;

/**
* setSpsCustNo
*
* @param mixed $spsCustNo
* @return self
*/
public function setSpsCustNo($spsCustNo): self;

/**
* getSpsPaymentNo
*
* @return string
*/
public function getSpsPaymentNo(): ?string;

/**
* setSpsPaymentNo
*
* @param mixed $spsPaymentNo
* @return self
*/
public function setSpsPaymentNo($spsPaymentNo) :self;

/**
* Get the value of responseInfoType
*/
public function getResponseInfoType(): ?string;

/**
* Set the value of responseInfoType
*
* @return self
*/
public function setResponseInfoType($responseInfoType): Payload;
}
12 changes: 10 additions & 2 deletions src/Contract/PaymentMethod/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ public abstract function saveCard(Payload $payload): Response;
* @param \Nekoding\LaravelSoftbank\Contract\Payload $payload
* @return Response
*/
// public abstract function updateCard(Payload $payload): Response;
public abstract function updateCard(Payload $payload): Response;

/**
* deleteCard
*
* @param \Nekoding\LaravelSoftbank\Contract\Payload $payload
* @return Response
*/
// public abstract function deleteCard(Payload $payload): Response;
public abstract function deleteCard(Payload $payload): Response;

/**
* getCard
*
* @param \Nekoding\LaravelSoftbank\Contract\Payload $payload
* @return Response
*/
public abstract function getCard(Payload $payload): Response;

}
21 changes: 18 additions & 3 deletions src/PaymentMethod/CreditCard/CreditCardPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class CreditCardPayment extends CreditCard
protected $continueCancelNoticeId = '';

protected $saveCardInfoRequestId = 'MG02-00101-101';
protected $updateCardInfoRequestId = '';
protected $deleteCardInfoRequestId = '';
protected $getCardInfoRequestId = '';
protected $updateCardInfoRequestId = 'MG02-00132-101';
protected $deleteCardInfoRequestId = 'MG02-00103-101"';
protected $getCardInfoRequestId = 'MG02-00104-101';


public function createTransaction(Payload $payload): Response
Expand Down Expand Up @@ -53,4 +53,19 @@ public function saveCard(Payload $payload): Response
{
return $this->createRequest($payload, $this->saveCardInfoRequestId);
}

public function updateCard(Payload $payload): Response
{
return $this->createRequest($payload, $this->updateCardInfoRequestId);
}

public function deleteCard(Payload $payload): Response
{
return $this->createRequest($payload, $this->deleteCardInfoRequestId);
}

public function getCard(Payload $payload): Response
{
return $this->createRequest($payload, $this->getCardInfoRequestId);
}
}
Loading

0 comments on commit 240c4c3

Please sign in to comment.