react-native-pos-pagseguro 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/PosPagseguro.podspec +29 -0
- package/README.md +193 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +132 -0
- package/android/gradle.properties +5 -0
- package/android/libs/wrapper-1.30.52.aar +0 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/PosPagseguro.kt +251 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/PosPagseguroPackage.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/SubAcquirer.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/TransactionResult.kt +53 -0
- package/android/src/main/java/com/margelo/nitro/pospagseguro/maps/Userdata.kt +17 -0
- package/ios/PosPagseguro.swift +5 -0
- package/lib/module/PosPagseguro.nitro.js +4 -0
- package/lib/module/PosPagseguro.nitro.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/pag_seguro.js +290 -0
- package/lib/module/pag_seguro.js.map +1 -0
- package/lib/module/types/device.js +71 -0
- package/lib/module/types/device.js.map +1 -0
- package/lib/module/types/exceptions.js +16 -0
- package/lib/module/types/exceptions.js.map +1 -0
- package/lib/module/types/payments.js +84 -0
- package/lib/module/types/payments.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PosPagseguro.nitro.d.ts +27 -0
- package/lib/typescript/src/PosPagseguro.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/pag_seguro.d.ts +188 -0
- package/lib/typescript/src/pag_seguro.d.ts.map +1 -0
- package/lib/typescript/src/types/device.d.ts +92 -0
- package/lib/typescript/src/types/device.d.ts.map +1 -0
- package/lib/typescript/src/types/exceptions.d.ts +16 -0
- package/lib/typescript/src/types/exceptions.d.ts.map +1 -0
- package/lib/typescript/src/types/payments.d.ts +205 -0
- package/lib/typescript/src/types/payments.d.ts.map +1 -0
- package/nitro.json +16 -0
- package/nitrogen/generated/android/c++/JCapabilities.hpp +100 -0
- package/nitrogen/generated/android/c++/JCardIssuerNationality.hpp +61 -0
- package/nitrogen/generated/android/c++/JCustomError.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.cpp +248 -0
- package/nitrogen/generated/android/c++/JHybridPosPagseguroSpec.hpp +81 -0
- package/nitrogen/generated/android/c++/JInstallmentTypes.hpp +61 -0
- package/nitrogen/generated/android/c++/JPaymentData.hpp +81 -0
- package/nitrogen/generated/android/c++/JPaymentTypes.hpp +64 -0
- package/nitrogen/generated/android/c++/JSubAcquirer.hpp +101 -0
- package/nitrogen/generated/android/c++/JTransactionResult.hpp +208 -0
- package/nitrogen/generated/android/c++/JUserData.hpp +86 -0
- package/nitrogen/generated/android/c++/JVariant_CustomError_TransactionResult.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_CustomError_TransactionResult.hpp +75 -0
- package/nitrogen/generated/android/c++/JVariant_Double_CustomError.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Double_CustomError.hpp +70 -0
- package/nitrogen/generated/android/c++/JVoidPayData.hpp +72 -0
- package/nitrogen/generated/android/c++/JVoidType.hpp +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Capabilities.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CardIssuerNationality.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/CustomError.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/HybridPosPagseguroSpec.kt +132 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/InstallmentTypes.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/PaymentData.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/PaymentTypes.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/SubAcquirer.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/TransactionResult.kt +149 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/UserData.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_CustomError_TransactionResult.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/Variant_Double_CustomError.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/VoidPayData.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/VoidType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pospagseguro/pospagseguroOnLoad.kt +35 -0
- package/nitrogen/generated/android/pospagseguro+autolinking.cmake +83 -0
- package/nitrogen/generated/android/pospagseguro+autolinking.gradle +27 -0
- package/nitrogen/generated/android/pospagseguroOnLoad.cpp +46 -0
- package/nitrogen/generated/android/pospagseguroOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/PosPagseguro+autolinking.rb +60 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Bridge.hpp +422 -0
- package/nitrogen/generated/ios/PosPagseguro-Swift-Cxx-Umbrella.hpp +81 -0
- package/nitrogen/generated/ios/c++/HybridPosPagseguroSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPosPagseguroSpecSwift.hpp +236 -0
- package/nitrogen/generated/ios/swift/Capabilities.swift +96 -0
- package/nitrogen/generated/ios/swift/CardIssuerNationality.swift +44 -0
- package/nitrogen/generated/ios/swift/CustomError.swift +35 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_CustomError__TransactionResult_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_double__CustomError_.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridPosPagseguroSpec.swift +72 -0
- package/nitrogen/generated/ios/swift/HybridPosPagseguroSpec_cxx.swift +434 -0
- package/nitrogen/generated/ios/swift/InstallmentTypes.swift +44 -0
- package/nitrogen/generated/ios/swift/PaymentData.swift +74 -0
- package/nitrogen/generated/ios/swift/PaymentTypes.swift +48 -0
- package/nitrogen/generated/ios/swift/SubAcquirer.swift +85 -0
- package/nitrogen/generated/ios/swift/TransactionResult.swift +674 -0
- package/nitrogen/generated/ios/swift/UserData.swift +169 -0
- package/nitrogen/generated/ios/swift/Variant_CustomError_TransactionResult.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_Double_CustomError.swift +18 -0
- package/nitrogen/generated/ios/swift/VoidPayData.swift +64 -0
- package/nitrogen/generated/ios/swift/VoidType.swift +40 -0
- package/nitrogen/generated/shared/c++/Capabilities.hpp +76 -0
- package/nitrogen/generated/shared/c++/CardIssuerNationality.hpp +80 -0
- package/nitrogen/generated/shared/c++/CustomError.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridPosPagseguroSpec.cpp +37 -0
- package/nitrogen/generated/shared/c++/HybridPosPagseguroSpec.hpp +102 -0
- package/nitrogen/generated/shared/c++/InstallmentTypes.hpp +63 -0
- package/nitrogen/generated/shared/c++/PaymentData.hpp +108 -0
- package/nitrogen/generated/shared/c++/PaymentTypes.hpp +69 -0
- package/nitrogen/generated/shared/c++/SubAcquirer.hpp +127 -0
- package/nitrogen/generated/shared/c++/TransactionResult.hpp +234 -0
- package/nitrogen/generated/shared/c++/UserData.hpp +112 -0
- package/nitrogen/generated/shared/c++/VoidPayData.hpp +98 -0
- package/nitrogen/generated/shared/c++/VoidType.hpp +62 -0
- package/package.json +179 -0
- package/src/PosPagseguro.nitro.ts +32 -0
- package/src/index.ts +19 -0
- package/src/pag_seguro.ts +306 -0
- package/src/types/device.ts +97 -0
- package/src/types/exceptions.ts +19 -0
- package/src/types/payments.ts +215 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package com.margelo.nitro.pospagseguro
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
+
|
|
8
|
+
class PosPagseguroPackage : BaseReactPackage() {
|
|
9
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
14
|
+
return ReactModuleInfoProvider { HashMap() }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
companion object {
|
|
19
|
+
init {
|
|
20
|
+
System.loadLibrary("pospagseguro")
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package com.margelo.nitro.pospagseguro.maps
|
|
2
|
+
|
|
3
|
+
import com.margelo.nitro.pospagseguro.SubAcquirer
|
|
4
|
+
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagSubAcquirerResult
|
|
5
|
+
|
|
6
|
+
fun PlugPagSubAcquirerResult.toSubAcquirer(): SubAcquirer {
|
|
7
|
+
return SubAcquirer(
|
|
8
|
+
name = this.name,
|
|
9
|
+
address = this.address,
|
|
10
|
+
city = this.city,
|
|
11
|
+
uf = this.uf,
|
|
12
|
+
country = this.country,
|
|
13
|
+
zip_code = this.zipCode,
|
|
14
|
+
mcc = this.mcc,
|
|
15
|
+
cnpj_cpf = this.cnpjCpf,
|
|
16
|
+
doc_type = this.docType,
|
|
17
|
+
telephone = this.telephone,
|
|
18
|
+
full_name = this.fullName,
|
|
19
|
+
merchant_id = this.merchantId
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
package com.margelo.nitro.pospagseguro.maps
|
|
2
|
+
|
|
3
|
+
import com.margelo.nitro.pospagseguro.TransactionResult
|
|
4
|
+
import com.margelo.nitro.pospagseguro.CardIssuerNationality
|
|
5
|
+
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagTransactionResult
|
|
6
|
+
|
|
7
|
+
fun PlugPagTransactionResult.toTransactionResult(): TransactionResult {
|
|
8
|
+
return TransactionResult(
|
|
9
|
+
transaction_code = this.transactionCode,
|
|
10
|
+
transaction_id = this.transactionId,
|
|
11
|
+
date = this.date,
|
|
12
|
+
time = this.time,
|
|
13
|
+
host_nsu = this.hostNsu,
|
|
14
|
+
card_brand = this.cardBrand,
|
|
15
|
+
bin = this.bin,
|
|
16
|
+
holder = this.holder,
|
|
17
|
+
user_reference = this.userReference,
|
|
18
|
+
terminal_serial_number = this.terminalSerialNumber,
|
|
19
|
+
amount = this.amount,
|
|
20
|
+
available_balance = this.availableBalance,
|
|
21
|
+
card_application = this.cardApplication,
|
|
22
|
+
label = this.label,
|
|
23
|
+
holder_name = this.holderName,
|
|
24
|
+
extended_holder_name = this.extendedHolderName,
|
|
25
|
+
card_issuer_nationality = when(this.cardIssuerNationality){
|
|
26
|
+
br.com.uol.pagseguro.plugpagservice.wrapper.CardIssuerNationality.UNAVAILABLE -> CardIssuerNationality.UNAVAILABLE
|
|
27
|
+
br.com.uol.pagseguro.plugpagservice.wrapper.CardIssuerNationality.NATIONAL -> CardIssuerNationality.DOMESTIC
|
|
28
|
+
br.com.uol.pagseguro.plugpagservice.wrapper.CardIssuerNationality.INTERNATIONAL -> CardIssuerNationality.INTERNATIONAL
|
|
29
|
+
else -> CardIssuerNationality.UNAVAILABLE
|
|
30
|
+
},
|
|
31
|
+
reader_model = this.readerModel,
|
|
32
|
+
nsu = this.nsu,
|
|
33
|
+
auto_code = this.autoCode,
|
|
34
|
+
installments = this.installments?.toDouble(),
|
|
35
|
+
original_amount = this.originalAmount?.toDouble(),
|
|
36
|
+
buyer_name = this.buyerName,
|
|
37
|
+
payment_type = this.paymentType?.toDouble(),
|
|
38
|
+
type_transaction = this.typeTransaction,
|
|
39
|
+
app_identification = this.appIdentification,
|
|
40
|
+
card_hash = this.cardHash,
|
|
41
|
+
pre_auto_due_date = this.preAutoDueDate,
|
|
42
|
+
pre_auto_original_amount = this.preAutoOriginalAmount,
|
|
43
|
+
user_registered = this.userRegistered.toDouble(),
|
|
44
|
+
accumulated_value = this.accumulatedValue,
|
|
45
|
+
consumer_identification = this.consumerIdentification,
|
|
46
|
+
current_balance = this.currentBalance,
|
|
47
|
+
consumer_phone_number = this.consumerPhoneNumber,
|
|
48
|
+
clube_pag_screens_ids = this.clubePagScreensIds,
|
|
49
|
+
partial_pay_partially_authorized_amount = this.partialPayPartiallyAuthorizedAmount,
|
|
50
|
+
partial_pay_remaining_amount = this.partialPayRemainingAmount,
|
|
51
|
+
pix_tx_id_code = this.pixTxIdCode
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.margelo.nitro.pospagseguro.maps
|
|
2
|
+
|
|
3
|
+
import com.margelo.nitro.pospagseguro.UserData
|
|
4
|
+
import br.com.uol.pagseguro.plugpagservice.wrapper.PlugPagUserDataResult
|
|
5
|
+
|
|
6
|
+
fun PlugPagUserDataResult.toUserData(): UserData {
|
|
7
|
+
return UserData(
|
|
8
|
+
address = this.address,
|
|
9
|
+
city = this.city,
|
|
10
|
+
cnpj_cpf = this.cnpjCpf,
|
|
11
|
+
address_complement = this.addressComplement,
|
|
12
|
+
company_name = this.companyName,
|
|
13
|
+
nick_name = this.userNickName,
|
|
14
|
+
address_state = this.addressState,
|
|
15
|
+
email = this.email
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["PosPagseguro.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import PagSeguro from "./pag_seguro.js";
|
|
4
|
+
import { PaymentError, PrintError } from "./types/exceptions.js";
|
|
5
|
+
import { InstallmentTypes, PaymentTypes, VoidType } from "./types/payments.js";
|
|
6
|
+
export { PagSeguro as default, VoidType, PrintError, PaymentError, PaymentTypes, InstallmentTypes };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PagSeguro","PaymentError","PrintError","InstallmentTypes","PaymentTypes","VoidType","default"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,SAAS,MAAM,iBAAc;AACpC,SAASC,YAAY,EAAEC,UAAU,QAAQ,uBAAoB;AAC7D,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,qBAAkB;AAS3E,SACEL,SAAS,IAAIM,OAAO,EACpBD,QAAQ,EACRH,UAAU,EACVD,YAAY,EACZG,YAAY,EACZD,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from "react-native-nitro-modules";
|
|
4
|
+
import { InstallmentTypes, PaymentTypes, VoidType } from "./types/payments.js";
|
|
5
|
+
import { AbordError, PaymentError, PrintError } from "./types/exceptions.js";
|
|
6
|
+
import { Capabilities } from "./types/device.js";
|
|
7
|
+
const PosPagseguroHybridObject = NitroModules.createHybridObject('PosPagseguro');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* PagSeguro POS SDK para React Native
|
|
11
|
+
*
|
|
12
|
+
* Biblioteca de alto desempenho para integração com terminais PagSeguro (Moderninha, Smart, Pro, etc.)
|
|
13
|
+
* utilizando react-native-nitro-modules para comunicação nativa direta em Swift (iOS) e Kotlin (Android).
|
|
14
|
+
*
|
|
15
|
+
* ### Funcionalidades principais
|
|
16
|
+
* - Inicialização e ativação do terminal
|
|
17
|
+
* - Pagamentos: Crédito, Débito, Voucher e PIX
|
|
18
|
+
* - Parcelamento (à vista, lojista sem juros, comprador com juros)
|
|
19
|
+
* - Cancelamento/estorno de transações
|
|
20
|
+
* - Consulta da última transação aprovada
|
|
21
|
+
* - Reimpressão de vias (cliente e estabelecimento)
|
|
22
|
+
* - Impressão personalizada (arquivo ou Base64)
|
|
23
|
+
* - Aborto de operações em andamento
|
|
24
|
+
* - Reinício do terminal
|
|
25
|
+
* - Consulta de informações do dispositivo e estabelecimento
|
|
26
|
+
* - Verificação de recursos (impressora, NFC, chip, tarja, etc.)
|
|
27
|
+
*
|
|
28
|
+
* ### Tratamento de erros
|
|
29
|
+
* A maioria dos métodos assíncronos lança exceções específicas:
|
|
30
|
+
* - {@link PaymentError} → Erros de pagamento, validação ou comunicação
|
|
31
|
+
* - {@link PrintError} → Falhas na impressão ou reimpressão
|
|
32
|
+
* - {@link AbordError} → Erro ao tentar abortar operação
|
|
33
|
+
*
|
|
34
|
+
* ### Exemplo básico de uso
|
|
35
|
+
* ```ts
|
|
36
|
+
* await PagSeguro.initialize("SEU_CODIGO");
|
|
37
|
+
*
|
|
38
|
+
* const resultado = await PagSeguro.do_payment({
|
|
39
|
+
* amount: 1000, // R$ 10.00
|
|
40
|
+
* type: PaymentTypes.CREDIT,
|
|
41
|
+
* installment_type: InstallmentTypes.SELLER_INSTALLMENT,
|
|
42
|
+
* installments: 3,
|
|
43
|
+
* print_receipt: true
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* console.log("NSU:", resultado.transaction_code);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @module PagSeguro
|
|
50
|
+
*/
|
|
51
|
+
export default class PagSeguro {
|
|
52
|
+
/**
|
|
53
|
+
* Inicializa o terminal PagSeguro com o código de ativação fornecido.
|
|
54
|
+
*
|
|
55
|
+
* Deve ser chamado antes de qualquer outra operação.
|
|
56
|
+
* Após a inicialização bem-sucedida, o terminal fica autenticado e pronto para pagamentos.
|
|
57
|
+
*
|
|
58
|
+
* @param activation_code Código de ativação do terminal (fornecido pelo PagSeguro)
|
|
59
|
+
* @throws PaymentError Caso o código seja inválido ou ocorra falha na comunicação
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* await PagSeguro.initialize("ABC123456");
|
|
63
|
+
*/
|
|
64
|
+
static initialize(activation_code) {
|
|
65
|
+
PosPagseguroHybridObject.initialize(activation_code);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reinicia o terminal PagSeguro.
|
|
69
|
+
*/
|
|
70
|
+
static reboot() {
|
|
71
|
+
PosPagseguroHybridObject.reboot();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Realiza um pagamento no terminal PagSeguro.
|
|
76
|
+
*
|
|
77
|
+
* Suporta todos os tipos de pagamento disponíveis (crédito, débito, voucher, PIX)
|
|
78
|
+
* e diferentes modalidades de parcelamento.
|
|
79
|
+
*
|
|
80
|
+
* @param data Dados do pagamento
|
|
81
|
+
* @param process_callback Callback opcional chamado com mensagens de progresso (ex: "APROXIME, INSIRA OU PASSE O CARTÃO")
|
|
82
|
+
* @returns Resultado completo da transação aprovada
|
|
83
|
+
* @throws PaymentError Em caso de erro de validação, rejeição ou falha na comunicação
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const tx = await PagSeguro.do_payment({
|
|
87
|
+
* amount: 2500, // R$ 25.00
|
|
88
|
+
* type: PaymentTypes.PIX,
|
|
89
|
+
* installment_type: InstallmentTypes.NO_INSTALLMENT,
|
|
90
|
+
* installments: 1,
|
|
91
|
+
* print_receipt: true
|
|
92
|
+
* });
|
|
93
|
+
*/
|
|
94
|
+
static async do_payment(data, process_callback = () => {}) {
|
|
95
|
+
validate_payment_data(data);
|
|
96
|
+
const r = await PosPagseguroHybridObject.doPayment(data, process_callback);
|
|
97
|
+
if ("message" in r && "code" in r) throw new PaymentError(r.code, r.message);
|
|
98
|
+
return r;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Realiza o cancelamento ou estorno de uma transação previamente aprovada.
|
|
102
|
+
*
|
|
103
|
+
* Funciona apenas para transações realizadas no mesmo dia (regra PagSeguro).
|
|
104
|
+
* Para cancelamentos administrativos de dias anteriores, usar o portal.
|
|
105
|
+
*
|
|
106
|
+
* @param data Dados necessários para identificar a transação a ser cancelada
|
|
107
|
+
* @param process_callback Callback opcional com mensagens de progresso
|
|
108
|
+
* @returns Resultado da operação de cancelamento
|
|
109
|
+
* @throws PaymentError Em caso de erro de validação ou rejeição
|
|
110
|
+
*/
|
|
111
|
+
static async void_payment(data, process_callback = () => {}) {
|
|
112
|
+
validate_void_pay_data(data);
|
|
113
|
+
const r = await PosPagseguroHybridObject.voidPayment(data, process_callback);
|
|
114
|
+
if ("message" in r && "code" in r) throw new PaymentError(r.code, r.message);
|
|
115
|
+
return r;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Aborta imediatamente qualquer operação em andamento no terminal
|
|
120
|
+
*
|
|
121
|
+
* @throws AbordError Caso o aborto não seja possível ou falhe
|
|
122
|
+
*/
|
|
123
|
+
static abort_current_operation() {
|
|
124
|
+
const r = PosPagseguroHybridObject.abort();
|
|
125
|
+
if (r == undefined) return;
|
|
126
|
+
if ("message" in r && "code" in r) throw new AbordError(r.code, r.message);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Obtém os dados da última transação aprovada realizada no terminal.
|
|
131
|
+
*
|
|
132
|
+
* @returns Dados completos da transação (valor, NSU, bandeira, etc.)
|
|
133
|
+
* @throws PaymentError Se não houver transação aprovada ou em caso de erro
|
|
134
|
+
*/
|
|
135
|
+
static get_last_approved_transaction() {
|
|
136
|
+
const r = PosPagseguroHybridObject.getLastApprovedTransaction();
|
|
137
|
+
if ("message" in r && "code" in r) throw new PaymentError(r.code, r.message);
|
|
138
|
+
return r;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reimprime a via do cliente da última transação aprovada.
|
|
142
|
+
*
|
|
143
|
+
* @returns Linhas impressas
|
|
144
|
+
* @throws PrintError Em caso de falha na impressora
|
|
145
|
+
*/
|
|
146
|
+
static async reprint_customer_receipt() {
|
|
147
|
+
const r = await PosPagseguroHybridObject.reprintCustomerReceipt();
|
|
148
|
+
if (typeof r === "number") return r;
|
|
149
|
+
throw new PrintError(r.code, r.message);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Reimprime a via do estabelecimento da última transação aprovada.
|
|
154
|
+
*
|
|
155
|
+
* @returns Linhas impressas
|
|
156
|
+
* @throws PrintError Em caso de falha
|
|
157
|
+
*/
|
|
158
|
+
static async reprint_stablishment_receipt() {
|
|
159
|
+
const r = await PosPagseguroHybridObject.reprintStablishmentReceipt();
|
|
160
|
+
if (typeof r === "number") return r;
|
|
161
|
+
throw new PrintError(r.code, r.message);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Verifica se há usuário autenticado.
|
|
166
|
+
*/
|
|
167
|
+
static is_authenticated() {
|
|
168
|
+
return PosPagseguroHybridObject.isAuthenticated();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Verifica se o terminal está executando alguma operação no momento.
|
|
172
|
+
*/
|
|
173
|
+
static is_busy() {
|
|
174
|
+
return PosPagseguroHybridObject.isServiceBusy();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Retorna o modelo do terminal PagSeguro.
|
|
178
|
+
*/
|
|
179
|
+
static get_model() {
|
|
180
|
+
return PosPagseguroHybridObject.getModel();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Retorna os dados do usuário logado no terminal (vendedor).
|
|
184
|
+
*/
|
|
185
|
+
static get_userdata() {
|
|
186
|
+
return PosPagseguroHybridObject.getUserData();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Retorna o número de série do terminal.
|
|
190
|
+
*/
|
|
191
|
+
static get_serial_number() {
|
|
192
|
+
return PosPagseguroHybridObject.getSerialNumber();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Retorna os dados do estabelecimento cadastrado no terminal (subadquirente).
|
|
196
|
+
*/
|
|
197
|
+
static get_sub_acquirer_data() {
|
|
198
|
+
return PosPagseguroHybridObject.getSubAcquirerData();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Imprime um arquivo de imagem armazenado no dispositivo.
|
|
202
|
+
*
|
|
203
|
+
* @param path Caminho completo do arquivo no filesystem
|
|
204
|
+
* @param quality Qualidade da impressão. Padrão: 1
|
|
205
|
+
* @param bottomPad Número de linhas em branco ao final. Padrão: 70
|
|
206
|
+
* @returns Linhas impressas
|
|
207
|
+
* @throws PrintError Em caso de falha
|
|
208
|
+
*/
|
|
209
|
+
static async print_from_filepath(path, quality = 1, bottomPad = 70) {
|
|
210
|
+
const r = await PosPagseguroHybridObject.printFromFile(path, quality, bottomPad);
|
|
211
|
+
if (typeof r === "number") return r;
|
|
212
|
+
throw new PrintError(r.code, r.message);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Imprime uma imagem a partir de uma string Base64.
|
|
216
|
+
* @param base64str String no formato Base64 (sem prefixo data:image/...)
|
|
217
|
+
* @param quality Qualidade da impressão. Padrão: 1
|
|
218
|
+
* @param bottomPad Linhas em branco ao final. Padrão: 70
|
|
219
|
+
* @returns Linhas impressas
|
|
220
|
+
* @throws PrintError Em caso de falha
|
|
221
|
+
*/
|
|
222
|
+
static async print_from_base64(base64str, quality = 1, bottomPad = 70) {
|
|
223
|
+
const r = await PosPagseguroHybridObject.printFromBase64(base64str, quality, bottomPad);
|
|
224
|
+
if (typeof r === "number") return r;
|
|
225
|
+
throw new PrintError(r.code, r.message);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Verificação de recursos disponíveis no terminal.
|
|
229
|
+
*
|
|
230
|
+
* Permite adaptar a UI conforme os módulos presentes.
|
|
231
|
+
*/
|
|
232
|
+
static capabilities = {
|
|
233
|
+
/** Verifica presença de módulo Bluetooth */
|
|
234
|
+
has_bluetooth() {
|
|
235
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.BLUETOOTH);
|
|
236
|
+
},
|
|
237
|
+
/** Verifica leitor de tarja magnética */
|
|
238
|
+
has_mag() {
|
|
239
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.MAG);
|
|
240
|
+
},
|
|
241
|
+
/** Verifica leitor de chip (EMV) */
|
|
242
|
+
has_icc() {
|
|
243
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.ICC);
|
|
244
|
+
},
|
|
245
|
+
/** Verifica suporte a Contactless/NFC */
|
|
246
|
+
has_picc() {
|
|
247
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.PICC);
|
|
248
|
+
},
|
|
249
|
+
/** Verifica presença de impressora térmica */
|
|
250
|
+
has_printer() {
|
|
251
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.PRINTER);
|
|
252
|
+
},
|
|
253
|
+
/** Verifica conexão Ethernet */
|
|
254
|
+
has_ethernet() {
|
|
255
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.ETHERNET);
|
|
256
|
+
},
|
|
257
|
+
/** Verifica modem 3G/4G */
|
|
258
|
+
has_modem() {
|
|
259
|
+
return PosPagseguroHybridObject.hasCapability(Capabilities.MODEM);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function validate_payment_data(data) {
|
|
264
|
+
if (data.amount <= 0) throw new PaymentError("INVALID_ARG", "O valor deve ser maior que zero.");
|
|
265
|
+
if (data.installments < 1) throw new PaymentError("INVALID_ARG", "O número de parcelas deve ser pelo menos 1.");
|
|
266
|
+
if (!Object.values(PaymentTypes).includes(data.type)) throw new PaymentError("INVALID_ARG", "O tipo de pagamento informado não é válido.");
|
|
267
|
+
if (!Object.values(InstallmentTypes).includes(data.installment_type)) throw new PaymentError("INVALID_ARG", `O tipo de parcelamento informado não é válido.`);
|
|
268
|
+
if (data.user_reference !== undefined) {
|
|
269
|
+
const ref = String(data.user_reference);
|
|
270
|
+
const regex = /^[a-zA-Z0-9]+$/;
|
|
271
|
+
if (!regex.test(ref)) throw new PaymentError("INVALID_ARG", "A referência do usuário deve conter apenas letras ou números.");
|
|
272
|
+
}
|
|
273
|
+
;
|
|
274
|
+
}
|
|
275
|
+
;
|
|
276
|
+
function validate_void_pay_data(data) {
|
|
277
|
+
if (!data.transaction_code || typeof data.transaction_code !== 'string' || data.transaction_code.trim() === '') {
|
|
278
|
+
throw new PaymentError("INVALID_ARG", "O transaction_code é obrigatório e deve ser uma string não vazia.");
|
|
279
|
+
}
|
|
280
|
+
if (!data.transaction_id || typeof data.transaction_id !== 'string' || data.transaction_id.trim() === '') {
|
|
281
|
+
throw new PaymentError("INVALID_ARG", "O transaction_id é obrigatório e deve ser uma string não vazia.");
|
|
282
|
+
}
|
|
283
|
+
if (data.print_receipt !== undefined && typeof data.print_receipt !== 'boolean') {
|
|
284
|
+
throw new PaymentError("INVALID_ARG", "O print_receipt deve ser do tipo boolean.");
|
|
285
|
+
}
|
|
286
|
+
if (data.void_type !== undefined && !Object.values(VoidType).includes(data.void_type)) {
|
|
287
|
+
throw new PaymentError("INVALID_ARG", "O void_type informado não é válido.");
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=pag_seguro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","InstallmentTypes","PaymentTypes","VoidType","AbordError","PaymentError","PrintError","Capabilities","PosPagseguroHybridObject","createHybridObject","PagSeguro","initialize","activation_code","reboot","do_payment","data","process_callback","validate_payment_data","r","doPayment","code","message","void_payment","validate_void_pay_data","voidPayment","abort_current_operation","abort","undefined","get_last_approved_transaction","getLastApprovedTransaction","reprint_customer_receipt","reprintCustomerReceipt","reprint_stablishment_receipt","reprintStablishmentReceipt","is_authenticated","isAuthenticated","is_busy","isServiceBusy","get_model","getModel","get_userdata","getUserData","get_serial_number","getSerialNumber","get_sub_acquirer_data","getSubAcquirerData","print_from_filepath","path","quality","bottomPad","printFromFile","print_from_base64","base64str","printFromBase64","capabilities","has_bluetooth","hasCapability","BLUETOOTH","has_mag","MAG","has_icc","ICC","has_picc","PICC","has_printer","PRINTER","has_ethernet","ETHERNET","has_modem","MODEM","amount","installments","Object","values","includes","type","installment_type","user_reference","ref","String","regex","test","transaction_code","trim","transaction_id","print_receipt","void_type"],"sourceRoot":"..\\..\\src","sources":["pag_seguro.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,QAAQ,QAAoE,qBAAkB;AAEvI,SAASC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,uBAAoB;AACzE,SAASC,YAAY,QAAyC,mBAAgB;AAE9E,MAAMC,wBAAwB,GAAGR,YAAY,CAACS,kBAAkB,CAAe,cAAc,CAAC;;AAE9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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K3D,SAAS,IAAI,CAAC6C,MAAM,CAACC,MAAM,CAACtE,QAAQ,CAAC,CAACuE,QAAQ,CAAC3D,IAAI,CAACuE,SAAS,CAAC,EAAE;IACnF,MAAM,IAAIjF,YAAY,CAAC,aAAa,EAAE,qCAAqC,CAAC;EAChF;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var Capabilities = /*#__PURE__*/function (Capabilities) {
|
|
4
|
+
/**
|
|
5
|
+
* Módulo de leitor de tarja magnética.
|
|
6
|
+
*/
|
|
7
|
+
Capabilities[Capabilities["MAG"] = 1] = "MAG";
|
|
8
|
+
/**
|
|
9
|
+
* Módulo de leitor de chip.
|
|
10
|
+
*/
|
|
11
|
+
Capabilities[Capabilities["ICC"] = 2] = "ICC";
|
|
12
|
+
/**
|
|
13
|
+
* Módulo de leitura por aproximação (Contactless).
|
|
14
|
+
*/
|
|
15
|
+
Capabilities[Capabilities["PICC"] = 3] = "PICC";
|
|
16
|
+
/**
|
|
17
|
+
* Módulo de teclado seguro.
|
|
18
|
+
*/
|
|
19
|
+
Capabilities[Capabilities["PED"] = 4] = "PED";
|
|
20
|
+
/**
|
|
21
|
+
* Módulo de teclado externo.
|
|
22
|
+
*/
|
|
23
|
+
Capabilities[Capabilities["KEYBOARD"] = 5] = "KEYBOARD";
|
|
24
|
+
/**
|
|
25
|
+
* Módulo de impressora.
|
|
26
|
+
*/
|
|
27
|
+
Capabilities[Capabilities["PRINTER"] = 6] = "PRINTER";
|
|
28
|
+
/**
|
|
29
|
+
* Módulo de bluetooth.
|
|
30
|
+
*/
|
|
31
|
+
Capabilities[Capabilities["BLUETOOTH"] = 7] = "BLUETOOTH";
|
|
32
|
+
/**
|
|
33
|
+
* Módulo de caixa registradora.
|
|
34
|
+
*/
|
|
35
|
+
Capabilities[Capabilities["CASH_BOX"] = 8] = "CASH_BOX";
|
|
36
|
+
/**
|
|
37
|
+
* Módulo de tela auxiliar.
|
|
38
|
+
*/
|
|
39
|
+
Capabilities[Capabilities["CUSTOMER_DISPLAY"] = 9] = "CUSTOMER_DISPLAY";
|
|
40
|
+
/**
|
|
41
|
+
* Módulo de rede.
|
|
42
|
+
*/
|
|
43
|
+
Capabilities[Capabilities["ETHERNET"] = 10] = "ETHERNET";
|
|
44
|
+
/**
|
|
45
|
+
* Módulo de leitor de digital.
|
|
46
|
+
*/
|
|
47
|
+
Capabilities[Capabilities["FINGERPRINT_READER"] = 11] = "FINGERPRINT_READER";
|
|
48
|
+
/**
|
|
49
|
+
* Módulo de acelerômetro.
|
|
50
|
+
*/
|
|
51
|
+
Capabilities[Capabilities["G_SENSOR"] = 12] = "G_SENSOR";
|
|
52
|
+
/**
|
|
53
|
+
* Módulo de saída HDMI.
|
|
54
|
+
*/
|
|
55
|
+
Capabilities[Capabilities["HDMI"] = 13] = "HDMI";
|
|
56
|
+
/**
|
|
57
|
+
* Módulo de leitor de cartões.
|
|
58
|
+
*/
|
|
59
|
+
Capabilities[Capabilities["ID_CARD_READER"] = 14] = "ID_CARD_READER";
|
|
60
|
+
/**
|
|
61
|
+
* Módulo de SM.
|
|
62
|
+
*/
|
|
63
|
+
Capabilities[Capabilities["SM"] = 15] = "SM";
|
|
64
|
+
/**
|
|
65
|
+
* Módulo de modem.
|
|
66
|
+
*/
|
|
67
|
+
Capabilities[Capabilities["MODEM"] = 16] = "MODEM";
|
|
68
|
+
return Capabilities;
|
|
69
|
+
}(Capabilities || {});
|
|
70
|
+
export { Capabilities };
|
|
71
|
+
//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Capabilities"],"sourceRoot":"..\\..\\..\\src","sources":["types/device.ts"],"mappings":";;IA4BKA,YAAY,0BAAZA,YAAY;EACb;AACJ;AACA;EAHKA,YAAY,CAAZA,YAAY;EAKb;AACJ;AACA;EAPKA,YAAY,CAAZA,YAAY;EASb;AACJ;AACA;EAXKA,YAAY,CAAZA,YAAY;EAab;AACJ;AACA;EAfKA,YAAY,CAAZA,YAAY;EAiBb;AACJ;AACA;EAnBKA,YAAY,CAAZA,YAAY;EAqBb;AACJ;AACA;EAvBKA,YAAY,CAAZA,YAAY;EAyBb;AACJ;AACA;EA3BKA,YAAY,CAAZA,YAAY;EA6Bb;AACJ;AACA;EA/BKA,YAAY,CAAZA,YAAY;EAiCb;AACJ;AACA;EAnCKA,YAAY,CAAZA,YAAY;EAqCb;AACJ;AACA;EAvCKA,YAAY,CAAZA,YAAY;EAyCb;AACJ;AACA;EA3CKA,YAAY,CAAZA,YAAY;EA6Cb;AACJ;AACA;EA/CKA,YAAY,CAAZA,YAAY;EAiDb;AACJ;AACA;EAnDKA,YAAY,CAAZA,YAAY;EAqDb;AACJ;AACA;EAvDKA,YAAY,CAAZA,YAAY;EAyDb;AACJ;AACA;EA3DKA,YAAY,CAAZA,YAAY;EA6Db;AACJ;AACA;EA/DKA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA,EAAZA,YAAY;AAoEjB,SAASA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class CustomException extends Error {
|
|
4
|
+
constructor(code, message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.code = code;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
;
|
|
10
|
+
export class PaymentError extends CustomException {}
|
|
11
|
+
;
|
|
12
|
+
export class PrintError extends CustomException {}
|
|
13
|
+
;
|
|
14
|
+
export class AbordError extends CustomException {}
|
|
15
|
+
;
|
|
16
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CustomException","Error","constructor","code","message","PaymentError","PrintError","AbordError"],"sourceRoot":"..\\..\\..\\src","sources":["types/exceptions.ts"],"mappings":";;AAOA,MAAMA,eAAe,SAASC,KAAK,CAAC;EAEhCC,WAAWA,CAACC,IAAY,EAAEC,OAAe,EAAE;IACvC,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACD,IAAI,GAAGA,IAAI;EACpB;AACJ;AAAC;AAGD,OAAO,MAAME,YAAY,SAASL,eAAe;AAAE;AACnD,OAAO,MAAMM,UAAU,SAASN,eAAe;AAAE;AACjD,OAAO,MAAMO,UAAU,SAASP,eAAe;AAAE","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tipos de pagamento disponíveis.
|
|
5
|
+
*/
|
|
6
|
+
var PaymentTypes = /*#__PURE__*/function (PaymentTypes) {
|
|
7
|
+
/**
|
|
8
|
+
* Pagamento realizado via cartão de crédito.
|
|
9
|
+
*/
|
|
10
|
+
PaymentTypes[PaymentTypes["CREDIT"] = 1] = "CREDIT";
|
|
11
|
+
/**
|
|
12
|
+
* Pagamento realizado via cartão de débito.
|
|
13
|
+
*/
|
|
14
|
+
PaymentTypes[PaymentTypes["DEBIT"] = 2] = "DEBIT";
|
|
15
|
+
/**
|
|
16
|
+
* Pagamento realizado via voucher (vale-refeição, vale-alimentação etc.).
|
|
17
|
+
*/
|
|
18
|
+
PaymentTypes[PaymentTypes["VOUCHER"] = 3] = "VOUCHER";
|
|
19
|
+
/**
|
|
20
|
+
* Pagamento realizado via PIX.
|
|
21
|
+
*/
|
|
22
|
+
PaymentTypes[PaymentTypes["PIX"] = 5] = "PIX";
|
|
23
|
+
return PaymentTypes;
|
|
24
|
+
}(PaymentTypes || {});
|
|
25
|
+
/**
|
|
26
|
+
* Tipos de parcelamento disponíveis.
|
|
27
|
+
*/
|
|
28
|
+
var InstallmentTypes = /*#__PURE__*/function (InstallmentTypes) {
|
|
29
|
+
/**
|
|
30
|
+
* Pagamento sem parcelamento (à vista).
|
|
31
|
+
*/
|
|
32
|
+
InstallmentTypes[InstallmentTypes["NO_INSTALLMENT"] = 1] = "NO_INSTALLMENT";
|
|
33
|
+
/**
|
|
34
|
+
* Parcelamento realizado pelo lojista.
|
|
35
|
+
*/
|
|
36
|
+
InstallmentTypes[InstallmentTypes["SELLER_INSTALLMENT"] = 2] = "SELLER_INSTALLMENT";
|
|
37
|
+
/**
|
|
38
|
+
* Parcelamento realizado pelo comprador (administradora).
|
|
39
|
+
*/
|
|
40
|
+
InstallmentTypes[InstallmentTypes["BUYER_INSTALLMENT"] = 3] = "BUYER_INSTALLMENT";
|
|
41
|
+
return InstallmentTypes;
|
|
42
|
+
}(InstallmentTypes || {});
|
|
43
|
+
/**
|
|
44
|
+
* Tipo de operação de cancelamento/estorno.
|
|
45
|
+
*/
|
|
46
|
+
var VoidType = /*#__PURE__*/function (VoidType) {
|
|
47
|
+
/**
|
|
48
|
+
* Cancelamento de um pagamento já efetuado.
|
|
49
|
+
*/
|
|
50
|
+
VoidType[VoidType["PAYMENT"] = 1] = "PAYMENT";
|
|
51
|
+
/**
|
|
52
|
+
* Cancelamento de um QR Code PIX gerado (antes da leitura/captura).
|
|
53
|
+
*/
|
|
54
|
+
VoidType[VoidType["QRCODE"] = 2] = "QRCODE";
|
|
55
|
+
return VoidType;
|
|
56
|
+
}(VoidType || {});
|
|
57
|
+
/**
|
|
58
|
+
* Dados necessários para realizar um cancelamento/estorno.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Nacionalidade da bandeira/emissor do cartão.
|
|
62
|
+
*/
|
|
63
|
+
export let CardIssuerNationality = /*#__PURE__*/function (CardIssuerNationality) {
|
|
64
|
+
/**
|
|
65
|
+
* Informação não disponível ou não aplicável.
|
|
66
|
+
*/
|
|
67
|
+
CardIssuerNationality["UNAVAILABLE"] = "UNAVAILABLE";
|
|
68
|
+
/**
|
|
69
|
+
* Cartão emitido por instituição nacional (ex.: bandeiras brasileiras).
|
|
70
|
+
*/
|
|
71
|
+
CardIssuerNationality["DOMESTIC"] = "DOMESTIC";
|
|
72
|
+
/**
|
|
73
|
+
* Cartão emitido por instituição internacional.
|
|
74
|
+
*/
|
|
75
|
+
CardIssuerNationality["INTERNATIONAL"] = "INTERNATIONAL";
|
|
76
|
+
return CardIssuerNationality;
|
|
77
|
+
}({});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Resultado detalhado de uma transação de pagamento.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export { VoidType, PaymentTypes, InstallmentTypes };
|
|
84
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PaymentTypes","InstallmentTypes","VoidType","CardIssuerNationality"],"sourceRoot":"..\\..\\..\\src","sources":["types/payments.ts"],"mappings":";;AAAA;AACA;AACA;AAFA,IAGKA,YAAY,0BAAZA,YAAY;EACf;AACF;AACA;EAHKA,YAAY,CAAZA,YAAY;EAKf;AACF;AACA;EAPKA,YAAY,CAAZA,YAAY;EASf;AACF;AACA;EAXKA,YAAY,CAAZA,YAAY;EAaf;AACF;AACA;EAfKA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA,EAAZA,YAAY;AAmBjB;AACA;AACA;AAFA,IAGKC,gBAAgB,0BAAhBA,gBAAgB;EACnB;AACF;AACA;EAHKA,gBAAgB,CAAhBA,gBAAgB;EAKnB;AACF;AACA;EAPKA,gBAAgB,CAAhBA,gBAAgB;EASnB;AACF;AACA;EAXKA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA,EAAhBA,gBAAgB;AAerB;AACA;AACA;AAFA,IAGKC,QAAQ,0BAARA,QAAQ;EACX;AACF;AACA;EAHKA,QAAQ,CAARA,QAAQ;EAKX;AACF;AACA;EAPKA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA,EAARA,QAAQ;AA4Cb;AACA;AACA;AAqBA;AACA;AACA;AACA,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAC/B;AACF;AACA;EAHYA,qBAAqB;EAK/B;AACF;AACA;EAPYA,qBAAqB;EAS/B;AACF;AACA;EAXYA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;;AAejC;AACA;AACA;;AAgFA,SACED,QAAQ,EACRF,YAAY,EACZC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|