Skip to content

Commit

Permalink
Fix atualização de dados e retornando sender.hash em pagamento com ca…
Browse files Browse the repository at this point in the history
…rtão de crédito
  • Loading branch information
wchagas committed Aug 31, 2019
1 parent 33b207e commit c3a41b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
11 changes: 7 additions & 4 deletions example/Component/DirectPayment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ export default class Component extends React.Component {
//addressRequired: false
type: 3,
cost: 10.00,
street: 'Av João Lima',
street: 'Av Joao Lima',
number: 55,
complement: 'Casa',
district: 'Campeche',
city: 'Florianópolis',
city: 'Florianopolis',
state: 'SC',
country: 'BRA',
postalCode: '88063333'
Expand All @@ -110,11 +110,11 @@ export default class Component extends React.Component {

// Endereço de cobrança
billing: {
street: 'Av João Lima',
street: 'Av Joao Lima',
number: 55,
complement: 'Casa',
district: 'Campeche',
city: 'Florianópolis',
city: 'Florianopolis',
state: 'SC',
country: 'BRA',
postalCode: '88063333'
Expand Down Expand Up @@ -177,6 +177,9 @@ export default class Component extends React.Component {
*/
onSubmit(data) {

console.log('sending to API...')
console.log(data)

this.setState({
loading: true,
error: null,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pagseguro-react",
"version": "1.0.8",
"version": "1.0.9",
"author": "Willy Chagas <[email protected]",
"description": "Checkout transparente do pagseguro utilizando React",
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion src/DirectPayment/CreditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ export default class CreditCard extends React.Component {
shipping: this.props.shipping,
reference: this.props.reference,
billing: this.props.billing,
sender: this.props.sender,
sender: {
...this.props.sender,
hash: PagSeguroDirectPayment.getSenderHash(),
},
items: this.props.items.map(i => {
if (i.amount.toFixed) {
i.amount = i.amount.toFixed(2)
Expand Down
4 changes: 3 additions & 1 deletion src/DirectPayment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ export default class Component extends React.Component {
newState = { ...newState, ...data }
}

console.log(this.state)

this.setState(newState)
}

Expand Down Expand Up @@ -269,7 +271,7 @@ export default class Component extends React.Component {

{
active == 'payment' &&
<Payment onChangeStep={this.onChangeStep.bind(this)} {...props} />
<Payment onChangeStep={this.onChangeStep.bind(this)} {...props} {...this.state} />
}
</Forms>

Expand Down

0 comments on commit c3a41b2

Please sign in to comment.