react-native-moyasar-sdk
Version:
Official React Native Moyasar SDK - Integrate Credit Cards, Apple Pay, Samsung Pay, and STC Pay with simple interfaces for a seamless payment experience in your React Native app
40 lines (39 loc) • 1.05 kB
JavaScript
"use strict";
import { getCreditCardNetworkFromNumber } from "../../../../helpers/credit_card_utils.js";
import { CreditCardNetwork } from "../../../credit_card_network.js";
import { PaymentType } from "../../../payment_type.js";
export class CreditCardRequestSource {
type = PaymentType.creditCard;
constructor({
name,
number,
cvc,
month,
year,
tokenizeCard = false,
manualPayment = false
}) {
this.network = getCreditCardNetworkFromNumber(number);
this.name = name;
this.number = number;
this.cvc = cvc;
this.month = month;
this.year = year;
this.saveCard = tokenizeCard ? 'true' : 'false';
this.manual = manualPayment ? 'true' : 'false';
}
toJson() {
return {
type: this.type,
company: CreditCardNetwork[this.network],
name: this.name,
number: this.number,
cvc: this.cvc,
month: this.month,
year: this.year,
save_card: this.saveCard,
manual: this.manual
};
}
}
//# sourceMappingURL=credit_card_request_source.js.map