Skip to content

Commit 997fecb

Browse files
committed
Enable credit card xendit
Signed-off-by: Imre Nagi <[email protected]>
1 parent d8e8b45 commit 997fecb

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ This tables shows which payment channels that has been implemented by this proxy
9191

9292
| Channels | Midtrans | Xendit |
9393
| ------------------------------- | ----------------------------------- | ------------------------ |
94-
| Credit Card without installment | :white_check_mark: | :heavy_exclamation_mark: |
94+
| Credit Card without installment | :white_check_mark: | :white_check_mark: |
9595
| Credit Card with installment | :white_check_mark: | :x: |
9696
| BCA VA | :white_check_mark: | :white_check_mark: |
9797
| Mandiri VA | :white_check_mark: | :white_check_mark: |

gateway/xendit/credit_card.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package xendit
2+
3+
import (
4+
xinvoice "github.com/xendit/xendit-go/invoice"
5+
)
6+
7+
func NewCreditCardInvoice(rb *InvoiceRequestBuilder) (*CreditCardInvoice, error) {
8+
return &CreditCardInvoice{
9+
rb: rb,
10+
}, nil
11+
}
12+
13+
type CreditCardInvoice struct {
14+
rb *InvoiceRequestBuilder
15+
}
16+
17+
func (o *CreditCardInvoice) Build() (*xinvoice.CreateParams, error) {
18+
o.rb.AddPaymentMethod("CREDIT_CARD")
19+
req, err := o.rb.Build()
20+
if err != nil {
21+
return nil, err
22+
}
23+
return req, nil
24+
}

gateway/xendit/facade.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func NewInvoiceRequestFromInvoice(inv *invoice.Invoice) (*xinvoice.CreateParams,
5151
reqBuilder, err = NewPermataVAInvoice(req)
5252
case payment.SourceMandiriVA:
5353
reqBuilder, err = NewMandiriVAInvoice(req)
54+
case payment.SourceCreditCard:
55+
reqBuilder, err = NewCreditCardInvoice(req)
5456
}
5557
if err != nil {
5658
return nil, err

0 commit comments

Comments
 (0)