Skip to content

Commit

Permalink
Enable credit card xendit
Browse files Browse the repository at this point in the history
Signed-off-by: Imre Nagi <[email protected]>
  • Loading branch information
imrenagi committed May 28, 2020
1 parent d8e8b45 commit 997fecb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ This tables shows which payment channels that has been implemented by this proxy

| Channels | Midtrans | Xendit |
| ------------------------------- | ----------------------------------- | ------------------------ |
| Credit Card without installment | :white_check_mark: | :heavy_exclamation_mark: |
| Credit Card without installment | :white_check_mark: | :white_check_mark: |
| Credit Card with installment | :white_check_mark: | :x: |
| BCA VA | :white_check_mark: | :white_check_mark: |
| Mandiri VA | :white_check_mark: | :white_check_mark: |
Expand Down
24 changes: 24 additions & 0 deletions gateway/xendit/credit_card.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package xendit

import (
xinvoice "github.com/xendit/xendit-go/invoice"
)

func NewCreditCardInvoice(rb *InvoiceRequestBuilder) (*CreditCardInvoice, error) {
return &CreditCardInvoice{
rb: rb,
}, nil
}

type CreditCardInvoice struct {
rb *InvoiceRequestBuilder
}

func (o *CreditCardInvoice) Build() (*xinvoice.CreateParams, error) {
o.rb.AddPaymentMethod("CREDIT_CARD")
req, err := o.rb.Build()
if err != nil {
return nil, err
}
return req, nil
}
2 changes: 2 additions & 0 deletions gateway/xendit/facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func NewInvoiceRequestFromInvoice(inv *invoice.Invoice) (*xinvoice.CreateParams,
reqBuilder, err = NewPermataVAInvoice(req)
case payment.SourceMandiriVA:
reqBuilder, err = NewMandiriVAInvoice(req)
case payment.SourceCreditCard:
reqBuilder, err = NewCreditCardInvoice(req)
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 997fecb

Please sign in to comment.